﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class StartUIController : MonoBehaviour {

    public static StartUIController _instance;
    public Transform tf_leftBottom;
    public bool b_isMask = true;
    private bool b_isQueren;

    public Transform tf_LeftBottom;

    void Start() {
        _instance = this;
    }

    public void OnStartUIClick() {
        transform.Find("StartUI").gameObject.SetActive(false);
        b_isMask = false;
        b_isQueren = true;
    }

    public void OnYuanliClick() {
        if (b_isQueren) {
            transform.Find("yuanli").gameObject.SetActive(!transform.Find("yuanli").gameObject.activeSelf);
            transform.Find("tishi").gameObject.SetActive(false);
            if (transform.Find("yuanli").gameObject.activeSelf)
            {
                b_isMask = true;
                tf_LeftBottom.Find("yuanli").GetChild(0).gameObject.SetActive(true);
            }
            else
            {
                tf_LeftBottom.Find("yuanli").GetChild(0).gameObject.SetActive(false);
                b_isMask = false;
            }
        } 
    }

    public void OnTishiClick()
    {
        if (b_isQueren) {
            transform.Find("yuanli").gameObject.SetActive(false);
            transform.Find("tishi").gameObject.SetActive(!transform.Find("tishi").gameObject.activeSelf);
            //if (transform.Find("tishi").gameObject.activeSelf)
            //{
            b_isMask = true;
            tf_LeftBottom.Find("tishi").GetChild(0).gameObject.SetActive(true);
            tf_LeftBottom.Find("yuanli").GetChild(0).gameObject.SetActive(false);
            //}
            //             else
            //             {
            //                 b_isMask = false;
            //                 go_mask.SetActive(false);
            //                 tf_leftBottom.Find("tishi").GetComponent<Image>().sprite = s_tishiClose;
            //             }
        }   
    }

    //操作按鈕關閉
    public void OnCloseCaoZuo()
    {
        b_isMask = false;
        transform.Find("tishi").gameObject.SetActive(false);
        tf_LeftBottom.Find("tishi").GetChild(0).gameObject.SetActive(false);
    }

    //實驗原理確定
    public void OnSureShiYanYuanli()
    {
        b_isMask = false;

        transform.Find("yuanli").gameObject.SetActive(false);
    }

}
